 

package com.zdkj.subway.stm.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdkj.common.core.util.R;
import com.zdkj.common.log.annotation.SysLog;
import com.zdkj.subway.stm.entity.SwStHandworkCleanRecordDetails;
import com.zdkj.subway.stm.service.SwStHandworkCleanRecordDetailsService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * 手工清出记录从表  
 *
 * @author songtuo
 * @date 2020-07-07 18:08:07
 */
@RestController
@AllArgsConstructor
@RequestMapping("/swsthandworkcleanrecorddetails" )
@Api(value = "swsthandworkcleanrecorddetails", tags = "手工清出记录从表  管理")
public class SwStHandworkCleanRecordDetailsController {

    private final  SwStHandworkCleanRecordDetailsService swStHandworkCleanRecordDetailsService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param swStHandworkCleanRecordDetails 手工清出记录从表  
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public R getSwStHandworkCleanRecordDetailsPage(Page page, SwStHandworkCleanRecordDetails swStHandworkCleanRecordDetails) {
        return R.ok(swStHandworkCleanRecordDetailsService.page(page, Wrappers.query(swStHandworkCleanRecordDetails)));
    }


    /**
     * 通过id查询手工清出记录从表  
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    public R getById(@PathVariable("id" ) Integer id) {
        return R.ok(swStHandworkCleanRecordDetailsService.getById(id));
    }

    /**
     * 新增手工清出记录从表  
     * @param swStHandworkCleanRecordDetails 手工清出记录从表  
     * @return R
     */
    @ApiOperation(value = "新增手工清出记录从表  ", notes = "新增手工清出记录从表  ")
    @SysLog("新增手工清出记录从表  " )
    @PostMapping
    @PreAuthorize("@pms.hasPermission('generator_swsthandworkcleanrecorddetails_add')" )
    public R save(@RequestBody SwStHandworkCleanRecordDetails swStHandworkCleanRecordDetails) {
        return R.ok(swStHandworkCleanRecordDetailsService.save(swStHandworkCleanRecordDetails));
    }

    /**
     * 修改手工清出记录从表  
     * @param swStHandworkCleanRecordDetails 手工清出记录从表  
     * @return R
     */
    @ApiOperation(value = "修改手工清出记录从表  ", notes = "修改手工清出记录从表  ")
    @SysLog("修改手工清出记录从表  " )
    @PutMapping
    @PreAuthorize("@pms.hasPermission('generator_swsthandworkcleanrecorddetails_edit')" )
    public R updateById(@RequestBody SwStHandworkCleanRecordDetails swStHandworkCleanRecordDetails) {
        return R.ok(swStHandworkCleanRecordDetailsService.updateById(swStHandworkCleanRecordDetails));
    }

    /**
     * 通过id删除手工清出记录从表  
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除手工清出记录从表  ", notes = "通过id删除手工清出记录从表  ")
    @SysLog("通过id删除手工清出记录从表  " )
    @DeleteMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('generator_swsthandworkcleanrecorddetails_del')" )
    public R removeById(@PathVariable Integer id) {
        return R.ok(swStHandworkCleanRecordDetailsService.removeById(id));
    }

}
